<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html {
            font-size: 12px;
        }
        .parent {
            font-size: 1rem;
        }
        .child {
            font-size: 2em;
        }
    </style>
</head>
<body>
    <!-- 
        父元素设置了rem，子元素再设置em依旧有效
     -->
    <div class="parent">
        <div class="child">哈哈哈哈</div>
    </div>
</body>
</html>